Repository navigation
feat(id): invite terms extension — versioned postcard InviteBody (#12983) - #13046
Merged
Merged
Conversation
) Step 1 of the #5751 design record's implementation shape (§5): the signed invite event's body gains the delegation terms. - v2 wire form: `IDINV` magic + version byte, postcard body (#5674), then the signature over a v2 domain tag. The body carries `target` (a group, or a world + its fronting group), `uses_cap`, `depth_remaining`, `parent_digest`, and a `redeemer` pin, alongside the v1 fields. - The v1 fixed layout is now the legacy read form: events already minted in it keep parsing and verifying, carry the legacy terms (group target, no cap, depth 0, no parent, no pin), and re-serialize in their own form so their signatures still verify. - §1 budgets enforced: a v2 body over 512 bytes is refused at decode (and at mint); `Invitation::link`/`Invitation::bare` refuse a paste form over 512 characters at mint. - §2/§3 mechanics on the body: `InviteTerms::source`/`link` land the defaults (open delegation depth 1, moderator grant depth 0, link 7-day expiry + 25-use cap), `with_depth` enforces the source cap of 3, `child_terms` refuses a re-invite depth that is not strictly less than the parent's and stamps the parent digest, `check_redeemer` enforces the pin, `admits_redemption` applies the use cap. Oracles (the issue's): every-term body round-trips byte-identically; a v1 event still parses; an over-budget body is refused at decode and an over-budget paste form at mint; a pinned invite refuses another redeemer; depth never increases along a re-mint; link/source defaults land. Verified: cargo test -p id-directory — 281 passed / 0 failed (9 invite event tests, 6 new); cargo test --test invites (facade) — 23 passed / 0 failed (3 new); rustfmt clean on the changed files; Cargo.lock gains only the postcard dependency edge for id-directory.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 18 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Implements step 1 of the #5751 design record's implementation shape (§5) for #12983: the signed invite event's body now carries the delegation terms.
IDINVmagic + version byte (theIDKEYenvelope's shape), postcard body per id: design: Wire format & transport adapters — postcard schema, non-UDP carriers, relays/proxies #5674, signature over a v2 domain tag. New fields:target(group, or world + its fronting group),uses_cap: Option<u32>,depth_remaining: u8,parent_digest: Option<[u8;32]>,redeemer: Option<[u8;32]>.InviteEvent::signnow mints v2;sign_termsmints with terms.Invitation::link/Invitation::baremint constructors refuse a paste form over 512 chars.InviteTerms::source/::linkland the defaults (open-delegation depth 1, moderator-grant depth 0, link 7-day expiry + 25-use cap);with_depthcaps a source depth at 3;InviteBody::child_termsrefuses a re-invite depth not strictly below the parent's and stampsparent_digestfrom the parent's newdigest();check_redeemerenforces the pin;admits_redemptionapplies the use cap (the counting itself is step 2's journal).check_routeis unchanged apart from reading the group throughInviteBody::group()(the target's anchor group). id-directory gains thepostcarddependency in the sibling crates' style; the lockfile diff is that one edge.Evidence
cargo test -p id-directory— 281 passed / 0 failed, including 9 invite-event unit tests (6 new: every-term round-trip, v1 parse + re-serialize, over-budget decode refusal, redeemer pin, depth monotonicity, defaults, use cap).cargo test --test invites(facade) — 23 passed / 0 failed (3 new: v1 event still parses with legacy terms, terms round-trip + route check stays Verified, over-budget paste mint refused). One existing test was updated where the v1 role-byte offset andbody.groupfield access were tied to the old form.rustfmt --checkclean on all changed files;cargo clippy -p id-directory --all-targetsexits 0 with no warning sites in the changed files.Merge danger
Door: two-way for reading (both forms parse), one-way for writing (new mints are v2-only; there is no v2→v1 downgrade path, by design — v1 cannot carry the terms).
Blast radius: the invites module of id-directory; no other crate constructs
InviteBodyor callscheck_route(verified by grep across the repo). The one theoretical ambiguity — a v1 inviter key beginning with the v2 magic bytes — is named in the module docs; keys are random and v1 is a legacy read form.This closes #12983's step-1 scope. Follow-ons stay where they were: #12922 (capability_pin term) attaches to this terms object; redemption journaling / counting is §5 step 2.
Closes #12983
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.